<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateOrderGoods extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('order_goods', function (Blueprint $table) {
            $table->id();
            $table->foreignId('tenant_id')->default(0)->comment('租户id');
            $table->foreignId('shop_id')->default(0)->comment('店铺ID');
            $table->integer('order_id')->default(0)->comment('订单ID');
            $table->integer('good_id')->default(0)->comment('商品ID');
            $table->integer('good_spec_id')->default(0)->comment('商品规格ID，对应sku_id');
            $table->string('goods_spec')->default('')->comment('商品规格，使用（规格值1,规格值2）组合作为sku的表示，中间以英文逗号隔开');
            $table->string('goods_name')->default('')->comment('商品名称');
            $table->string('good_spec_name')->default('')->comment('sku规格名称');
            $table->decimal('goods_price',10,2)->default(0)->comment('商品销售价格');
            $table->string('good_supplier_name')->default('')->comment('进货名称');
            $table->string('good_supplier_spec_name')->default('')->comment('进货规格名称');
            $table->decimal('supplier_price')->default(0)->comment('进货价');
            $table->decimal('shipping', 10, 2)->default(0)->comment('运费');
            $table->string('goods_img')->default('')->comment('商品图片');
            $table->integer('goods_count')->default(0)->comment('商品数量');
            $table->integer('gift_flag')->default(0)->comment('是否赠品，0-否，1-是');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('order_goods');
    }
}
